home *** CD-ROM | disk | FTP | other *** search
- unit mleSMLContainer;
-
- interface
-
- uses
- Classes, DBTables, mleCommon, mleDataBindings, mleObjectCache, usXMLDoc;
-
- type
- TSMLContainer = class
- private
- FHTML: TStrings;
- FSML: string;
- FObjectCache: TObjectCache;
- FDatabase: TDatabase;
- FVariables: TStrings;
- FScripts: TStrings;
- FDataBindings: TDataBindings;
- protected
- BaseElement: TusXMLElement;
- Parser: TusXMLParser;
- procedure SetSML(aValue: string);
- public
- constructor Create(aPacket: TInfoPacket);
- destructor Destroy; override;
- procedure Resolve;
-
- property Database: TDatabase read FDatabase;
- property DataBindings: TDataBindings read FDataBindings;
- property HTML: TStrings read FHTML;
- property ObjectCache: TObjectCache read FObjectCache;
- property Scripts: TStrings read FScripts;
- property SML: string read FSML write SetSML;
- property Variables: TStrings read FVariables;
- end;
-
- implementation
-
- uses
- mleTagResolvers;
-
- { TSMLContainer }
-
- constructor TSMLContainer.Create(aPacket: TInfoPacket);
- begin
- inherited Create;
- FDatabase := aPacket.Database;
- FVariables := aPacket.Variables;
- FObjectCache := TObjectCache.Create;
- Parser := TusXMLParser.Create;
- FHTML := TStringList.Create;
- FScripts := TStringList.Create;
- FDataBindings := TDataBindings.Create;
- end;
-
- destructor TSMLContainer.Destroy;
- begin
- FDataBindings.Free;
- FScripts.Free;
- FObjectCache.Free;
- FHTML.Free;
- Parser.Free;
- inherited;
- end;
-
- procedure TSMLContainer.Resolve;
- begin
- with TSMLTagResolver.Create(Self, nil, BaseElement) do
- try
- Setup;
- Resolve;
- Self.HTML.Text := GetHTML;
- finally
- Free;
- end;
- end;
-
- procedure TSMLContainer.SetSML(aValue: string);
- begin
- if aValue <> FSML then
- begin
- Parser.LoadXML(aValue);
- BaseElement := Parser.Document.Root;
- end;
- end;
-
- end.
-